<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    h1 {
      text-align: center;

    }

    table {
      margin: 0 auto;
      border: 1px solid #000;
      border-collapse: collapse;
    }

    tr {
      border: 1px solid #000;
      text-align: center;
    }

    th {
      border: 1px solid #000;
      padding: 10px 30px;
    }

    td {
      border: 1px solid #000;
      padding: 5px 10px;
    }
  </style>
</head>

<body>
  <h1>2025年12月消费支出</h1>

  <script>
    let totalPrice = +prompt('请输入银行卡总额')
    let waterPrice = +prompt('请输入水费')
    let elecPrice = +prompt('请输入电费')
    let netPrice = +prompt('请输入网费')

    let balance = totalPrice - waterPrice - elecPrice - netPrice

    document.write(`
      <table>
        <tr>
          <th>银行卡总额</th>
          <th>水费</th>
          <th>电费</th>
          <th>网费</th>
          <th>银行卡余额</th>
        </tr>
        <tr>
          <td>${totalPrice}元</td>
          <td>${waterPrice}元</td>
          <td>${elecPrice}元</td>
          <td>${netPrice}元</td>
          <td>${balance}元</td>
        </tr>
    </table>
    `)
  </script>
</body>

</html>